import Cookie from 'js-cookie'
export default {
    state: {
        // 存储登录成功返回的token
        token: ''
    },
    mutations: {
        // 保存token
        setToken(state, value) {
           state.token = value;
           Cookie.set('token', value);
        },
        // 清除token，用户退出
        clearToken(state) {
           state.token = "";
           Cookie.remove('token');
        },
        // 页面刷新，重新获取tooken
        getToken(state){
           state.token = Cookie.get('token');
        }
    },
    actions: {

    }
}